<?php
require_once '../../global.inc.php';

//SESSION中取出页面内数据信息
$templateInfo			= $_SESSION["templateInfo"];
$instanceInfo			= $_SESSION["instanceInfo"];
$memberActivityArray 	= $_SESSION["memberActivityArray"];		//二维数组
$tag					= $_GET["tag"];				//展示方式（列表q，编辑e,积分结算s)

//释放不需要的SESSION资源
//unset($_SESSION["pageInfo"]);
//unset($_SESSION["userArray"]);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
body {
	margin-left: 3px;
	margin-top: 0px;
	margin-right: 3px;
	margin-bottom: 0px;
}
a {text-decoration:none}
a:hover {text-decoration:none}
img {border:0px;}
.STYLE1 {
	color: #e1e2e3;
	font-size: 12px;
}
.STYLE6 {color: #000000; font-size: 12; }
.STYLE10 {color: #000000; font-size: 12px; }
.STYLE19 {
	color: #344b50;
	font-size: 12px;
}
.STYLE21 {
	font-size: 12px;
	color: #3b6375;
}
.STYLE22 {
	font-size: 12px;
	color: #295568;
}
-->
</style>
<script type="text/javascript" src="../js/utils.js"></script>
<script type="text/javascript" src="js/instanceMember.js"></script>
</head>

<body>
<div align="center">
<?php 
   if($tag =="e"){
		echo "<h3>【".$instanceInfo['travel_date']."至".$instanceInfo['travel_date']."】 ".$templateInfo['subject']."</h3></p>";
		echo "<h3>参加活动会员维护</h3>";
   	}else if($tag =="s"){
		echo "<h3>【".$instanceInfo['travel_date']."至".$instanceInfo['travel_date']."】 ".$templateInfo['subject']."</h3></p>";
		echo "<h3>参加活动会员积分结算</h3>";
	}
?>

</div>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" >

  <tr>
    <td><table width="100%" align="center"  border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
      <tr>
      	<td width='2%' height='20' bgcolor='d3eaef' class='STYLE10'><div align='center'><input type='checkbox' name='checkbox' id='checkbox' onclick="checkChg('checkbox','checkbox2')"/></div></td>
        <td width="15%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员卡号</span></div></td>
        <td width="8%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员姓名</span></div></td>
        <td width="8%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">会员网名</span></div></td>
        <td width="10%" height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">联系电话</span></div></td>
        <td width="5%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">性别</span></div></td>
        <td width="5%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">积分</span></div></td>
        <td width="10%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">使用积分</span></div></td>
	    <td width="10%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">优惠额度</span></div></td>
        <td width="10%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">已交定金</span></div></td>
	    <td width="10%"  height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">应收余款</span></div></td>
        <td 			 height="20" bgcolor="d3eaef" class="STYLE6"><div align="center"><span class="STYLE10">备注</span></div></td>
      </tr>
	      <?php 
	      $saleFee			= $instanceInfo['sale_fee'];
	      $scorePercent 	= $instanceInfo['score_percent'];
	      $count = 0;
	      foreach ($memberActivityArray as $memberActivity) {
			$memberId		= $memberActivity["member_id"];			//会员卡号
			$memberNo		= $memberActivity["member_no"];			//会员卡号
			$memberName		= $memberActivity["member_name"];		//会员姓名
			$netName		= $memberActivity["net_name"];			//会员网名
			$sex			= $memberActivity["sex"];				//会员性别
			$mobile			= $memberActivity["mobile"];			//会员电话
			$score			= $memberActivity["score"];				//会员原有积分
			$payScore		= $memberActivity["pay_score"];			//会员本次使用
			$discountFee	= $memberActivity["discount_fee"];		//会员优惠额度
			$payFee			= $memberActivity["pay_fee"];			//会员已交定金
			$remainFee		= $saleFee-$discountFee-$payFee-$payScore;
			$comments		= $memberActivity["comments"];			//备注
			if($sex==1)  $sexName="男";   else $sexName="女";
			$count++;
		    echo "<tr>";
		    	echo "<td height='20' bgcolor='#FFFFFF'><div align='center'><input type='checkbox' name='checkbox2' id='$memberId' value='$memberId' /></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$memberNo</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$memberName</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$netName</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$mobile</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$sexName</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$score</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$payScore</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$discountFee</span></div></td>";
		       	echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$payFee</span></div></td>";
		       	echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$remainFee</span></div></td>";
		        echo "<td height='20' bgcolor='#FFFFFF' class='STYLE19'><div align='center'><span class='STYLE10'>$comments</span></div></td>";
		      echo "</tr>";
		  }
		  ?>
	  <tr>
	  	<td colspan="12" bgcolor="#FFFFFF" ><div align="center">
	  	<?php 
			if($tag=="e"){
				echo "<input type='button' id = 'bAdd' name='bAdd'   value='增加成员' onclick='addInstanceMember()'/>&nbsp";
				echo "<input type='button' id = 'bDel' name='bDel'   value='删除成员' onclick='deleteInstanceMember()'/>&nbsp";
				echo "<input type='button' id = 'bMod' name='bMod'   value='修改成员' onclick='modifyInstanceMember()'/>&nbsp";
			}else if($tag=="s"){
				echo "<input type='button' id = 'bScore' name='bScore'   value='结算积分' />&nbsp";
			}
			?>
				<input type="button" id = "button1" name="button1" value="返回" onclick="javascript:parent.window.close();"/>
			</div></td>
	  </tr>
    </table></td>
  </tr>

  <tr>
    <td height="30"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="33%"><div align="left">
        	<span class="STYLE22">
	        	共有【<?php echo $count ?>】 个会员报名参与活动
        	</span>
        </div></td>
        <td width="67%"></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>
